﻿// Write a program that calculates N!*K! / (K-N)! for given N and K (1<N<K).

using System;
using System.Numerics;

class NKFactorials
{
    static void Main()
    {
        Console.Write("Enter N : ");
        BigInteger numberN = BigInteger.Parse(Console.ReadLine());
        Console.Write("Enter K : ");
        BigInteger numberK = BigInteger.Parse(Console.ReadLine());

        if (numberN <= 1 || numberN >= numberK || numberK <= 2)
        {
            Console.WriteLine("Invalid input. The values should be 1 < N < K.");
        }
        else
        {
            BigInteger factorialN = 1;
            for (BigInteger i = 1; i <= numberN; i++)
            {
                factorialN *= i;
            }

            BigInteger factorialK = 1;
            for (BigInteger i = numberK - numberN + 1; i <= numberK; i++)
            {
                factorialK *= i;
            }

            BigInteger result = factorialN * factorialK;
            Console.WriteLine("The result of N!*K!/(K-N)! is : {0}", result);
        }
    }
}
